(function($, window, document, undefined) {
	function GetQueryString(key) {
		// key为url变量名称
		var urlGets = location.search.substr(1);
		if(urlGets.length > 0) {
			start = urlGets.indexOf(key + '=');
			if(start != -1) {
				start = start + key.length + 1;
				end = urlGets.indexOf('&', start);
				if(end == -1) {
					end = urlGets.length
				}
				return decodeURIComponent(urlGets.substring(start, end));
			}
		}
		return '';
	}
	var myname=document.getElementById('myname');
//	myname.innerHTML=localStorage.getItem("userid");
	myname.innerHTML=localStorage.getItem("user");



    //在1s内连续按两次返回退出
		var first = null;
		mui.back = function() {
			if (!first) {
				first = new Date().getTime();
				plus.nativeUI.toast('再按一次退出');
				setTimeout(function() {
					first = null;
				}, 1500)
			} else {
				if (new Date().getTime() - first < 1500) {
					plus.runtime.quit();
				}
			}
		}
})(window.mui || window, window, document, undefined);
$(function(){
	/*获取是否有未读的系统消息*/
    function unread(){
        var phone=localStorage.getItem("user");
        var data={
            'phone':phone
        }
        util.ajax('unread',data,unreadHnander);
    }
    function unreadHnander(data){
        if(data.start){
            $('.red-dian').css('display','block');
        }else{
            $('.red-dian').css('display','none');
        }
    }
    unread();

    $('.my-information').click(function(){
		window.location.href='message.html';
	});
});